Doing a query in SAS 9.1.3 against a Microsoft SQL Server table using SAS/ACCESS® Interface to Microsoft SQL Server returns
correct results. SAS/ACCESS Interface to Microsoft SQL Server in SAS 9.2 passes a substring function, which returns an incorrect result. Using the LIBNAME option DIRECT_SQL=NOWHERE does not have an effect on the results. The following code produces different results between SAS 9.1.3 and SAS 9.2.
proc format;
value $target
'12345678'='*'
'67890123'='*';
run;
options sastrace=',,,d' sastraceloc=saslog nostsuffix;
proc sql details="reduce_put_bench$" _tree;
create table work.tmp as
select * from test.awh_phone2 AS Phone_phone
where put(Phone_phone.s_phone,$target.) = '*';
quit;
SAS 9.1.3 generates the following code:
SQLSRV_2: Prepared:
SELECT "s_phone", "r_phone", "date_time", "Duration" FROM "awh_phone2"
SAS 9.2 generates this code:
SELECT "s_phone", "r_phone", "date_time", "Duration" FROM "awh_phone" WHERE
( ( ({fn SUBSTRING( "s_phone", 1, 1)} IN (
'12345678' , '67890123' ) ) ) OR ( ({fn SUBSTRING( "r_phone", 1, 1)} IN (
'12345678' , '67890123' ) ) ) OR ({fn SUBSTRING(
"s_phone", 1, 1)} = '*' ) OR ({fn SUBSTRING( "r_phone", 1, 1)} = '*' ) )
The workaround is to change the format as follows:
proc format;
value $target(default=8)
'12345678'='*'
'67890123'='*';
run;
Click the Hot Fix tab in this note to access the hot fix for this issue.
Operating System and Release Information
SAS System | SAS/ACCESS Interface to Microsoft SQL Server | 64-bit Enabled AIX | 9.2 TS2M3 | 9.3 TS1M0 |
64-bit Enabled HP-UX | 9.2 TS2M3 | 9.3 TS1M0 |
64-bit Enabled Solaris | 9.2 TS2M3 | 9.3 TS1M0 |
HP-UX IPF | 9.2 TS2M3 | 9.3 TS1M0 |
Linux | 9.2 TS2M3 | 9.3 TS1M0 |
Linux for x64 | 9.2 TS2M3 | 9.3 TS1M0 |
Solaris for x64 | 9.2 TS2M3 | 9.3 TS1M0 |
*
For software releases that are not yet generally available, the Fixed
Release is the software release in which the problem is planned to be
fixed.